using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;

namespace crud
{
    static class connection
    {
        private const string preConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
        private const string dbPath = "\\sunnet\\sunnet.mdb";
        public static OleDbConnection  ConnectToDataBase()
        {
            string dbDirectory = System.IO.Directory.GetCurrentDirectory().ToString();
            StringBuilder connectionString = new StringBuilder();
            connectionString.AppendFormat("{0}{1}{2}", preConnectionString, dbDirectory, dbPath);
            OleDbConnection dbConnection = new OleDbConnection(connectionString.ToString());
            return dbConnection;
        }
        public static void ConnectionOpen(OleDbConnection connection)
        {
            connection.Open();
        }
        public static void ConnectionClose(OleDbConnection connection)
        {
            connection.Close();
        }
         
    }
}
